home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-02-02 | 2.5 KB | 86 lines | [TEXT/MPS ] |
- #
- # compare-disks
- # MPW Shell script
- # Malcolm H. Teas
- # Apple Computer, Inc.
- #
- # Function:
- # Using the correspondence filelist, compare each corresponding set of file's
- # resources and data fork. Use the MPW tools resdiff and equal to help
- # generate the report.
- #
- # In-Outputs:
- # The first input parameter is the filename of a list of the corresponding
- # files. The second is the "d" for "disk", or "f" for "folder" parameter.
- # The report is written out to the current MPW window. The exit status is
- # the only output parameter.
- #
-
- # Set some debugging variables.
- set save-exit {exit}
- set exit 0
- set save-echo {echo}
- set echo 0
-
- # Establish the filelist.
- set filelist "{1}"
- open "{filelist}"
- find • "{filelist}"
-
- # And set up the folder/disk parm too.
- set folder "{2}"
-
- # Set up the rNames directory variable
- set rNames "{3}"
-
- # Loop on the filenames from the filelist.
- loop
-
- # Get the filenames in the loop variables USfile and localfile.
- # Get the US name from the filelist.
- find /•≈∞/ "{filelist}" # Get a line from filelist.
- break if `count -l "{filelist}.§"` == 0 # Exit loop if end.
- set USfile "`catenate "{filelist}.§"`"
-
- # Get the test name from the filelist.
- find /•≈∞/ "{filelist}" # Get the next line from filelist.
- if {status} == 2 # This filelist is bad, no matching name.
- confirm "There is a mismatched file in the filelist."
- exit 3 # Can't continue.
- end
- set localfile "`catenate "{filelist}.§"`"
-
- # If it's a folder, then add the folder colon now so we can find the file.
- if ({folder} == "f") OR ({folder} == "zf")
- set USfile ":{USfile}"
- set localfile ":{localfile}"
- end
-
- # Tell the user what is happening by adding the file header.
- # We don't want to see this text if we are in the special case of creating
- # the resource name text files!
- if ({folder} == "d") OR ({folder} == "f")
- echo "-- Master file: ∂"{USfile}∂","
- echo "-- Test file: ∂"{Localfile}∂".∂n"
- end
-
- # Now let's see if we are supposed to create the rNames.S files, or go straight
- # ahead and do the compare....
-
- if ({folder} == "zd") OR ({folder} == "zf") # "z" flags us that we want to create the .rNames.S files...
- create.rnamefile "{USfile}" "{rNames}"
- else
- resdiff "{USfile}" "{Localfile}" "{rNames}" # Compare the resources.
- equal -d "{USfile}" "{Localfile}" # Compare the data fork.
- end
-
- # Add blank line to the output in between files.
- echo
-
- end # End of loop on the files in the correspondence filelist.
-
- # Clean up and exit.
- close "{filelist}"
- set exit {save-exit}
- set echo {save-echo}
- exit 0